import fetch from '@/utils/request';
/**
 * 分类API对象
 * @module CouponApi
 */
const CouponApi = {
	/**
	 * @function usables
	 * @description 用户可领取优惠券
	 * @param  {Object} query 查询参数对象
	 * @param  {Object} param 分页参数对象
	 */
	usables: (query, param) => fetch.request({
		url: '/api/user/coupon/usables',
		method: 'POST',
		data: {
			query: query,
			param: param
		},
	}),
	/**
	 * @function get
	 * @description 用户领取优惠券
	 * @param  {String} couponId 优惠券id
	 */
	get: (couponId) => fetch.request({
		url: '/api/user/coupon/get',
		method: 'POST',
		data: {
			couponId: couponId,
		},
	}),
	/**
	 * @function unuses
	 * @description 用户未使用优惠券
	 * @param  {Object} coupon 查询参数对象
	 * @param  {Object} param 分页参数对象
	 */
	unuses: (coupon, param) => fetch.request({
		url: '/api/user/coupon/unuses',
		method: 'POST',
		data: {
			coupon: coupon,
			param: param
		},
	}),
	/**
	 * @function useds
	 * @description 用户已使用优惠券
	 * @param  {Object} query 查询参数对象
	 * @param  {Object} param 分页参数对象
	 */
	useds: (query, param) => fetch.request({
		url: '/api/user/coupon/useds',
		method: 'POST',
		data: {
			query: query,
			param: param
		},
	}),
	/**
	 * @function expires
	 * @description 用户过期优惠券
	 * @param  {Object} query 查询参数对象
	 * @param  {Object} param 分页参数对象
	 */
	expires: (query, param) => fetch.request({
		url: '/api/user/coupon/expires',
		method: 'POST',
		data: {
			query: query,
			param: param
		},
	}),
	
};
export default CouponApi;
